<?php
/**
 * Created by PhpStorm
 * User: shen.zk
 * Date: 2023/9/4
 * Time: 17:08
 * Comment: ''
 */

namespace App\Jobs;

use App\Repository\ApplyLogRepo;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Log;

class ApplylogJob extends Job
{
    use  InteractsWithQueue, Queueable, SerializesModels;
    protected $data;
    /**
     * 任务可尝试的次数
     *
     * @var int
     */
    public $tries = 2;

    /**
     * 任务失败前允许的最大异常数
     *
     * @var int
     */
    public $maxExceptions = 2;

    public function __construct(array $data)
    {
        $this->data = $data;
    }

    public function handle()
    {
        $info = $this->data;
        Log::info('[记录第三方请求信息]'.json_encode($info,JSON_UNESCAPED_UNICODE));
        ApplyLogRepo::getInstance()->saveApplyLog($info);
    }
}
